package com.xiaohei.EE_IBATIC_Demo.util;

import java.io.Reader;
import com.ibatis.common.resources.Resources;
import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.DaoManagerBuilder;

public class IBatisDaoFactory {
	static DaoManager daoManager ;
	static{
		try {
			Reader reader = Resources.getResourceAsReader("dao.xml");
			daoManager = DaoManagerBuilder.buildDaoManager(reader);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static Object getDao(Class daoClass)throws Exception{
		return daoManager.getDao(daoClass);
	}
}
